﻿using FPC.Offer.Common;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace FPC.Offer.UI.GeneralProcessor.SkyDriveHand
{
    /// <summary>
    /// ShareShowHandler 的摘要说明
    /// </summary>
    public class ShareShowHandler : IHttpHandler
    {
        FPC.Offer.Service.System_ShareTableSerevice Sky = new Service.System_ShareTableSerevice();
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            var id = Convert.ToInt32(context.Request["id"]);
            var Actioon = context.Request["Actioon"].ToString();
            var name = context.Request["name"];
            if (Actioon == EnumAction.Select.ToString())
            {
                List<Model.Dropbox_ShareFileTable> a = Sky.Find(w => w.ShaName == name).ToList();

                context.Response.Write(JsonConvert.SerializeObject(a.ToList()));
            }
            if (Actioon == EnumAction.Add.ToString())
            {


            }
            if (Actioon == EnumAction.Delete.ToString())
            {
                Model.Dropbox_ShareFileTable d = Sky.Find(w => w.ShareId == id).FirstOrDefault();

                int r = Sky.Delete(d);
                context.Response.Write(1);
            }
            if (Actioon == EnumAction.Update.ToString())
            {


            }




        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}